package com.example.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.demo.entity.Attendance;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.sql.Date;
import java.sql.Time;

/**
 * @author lai
 * @data 2021/12/12
 * @apiNote
 */
public interface AttendanceMapper extends BaseMapper<Attendance> {

    @Update("UPDATE sys_attendance SET offtime=#{offtime},ter_action=#{terAction} WHERE teacher_id=#{teacherId} AND ondate=#{ondate}")
    void updataByDate(Time offtime, Integer terAction, Integer teacherId, Date ondate);

    @Select("SELECT ter_action FROM `sys_attendance` WHERE teacher_id=#{teacherId} AND ondate=#{ondate}")
    Integer selectAction(Integer teacherId, Date ondate);
}
